var userInfo = null;
$.ajax({
    url: "/user/queryUserMessage",
    type: "get",
    //同步
    async: false,
    success: function(res) {

        if (res.error && res.error == 400) {
            location.href = "login.html";
        }
        userInfo = res;
        console.log(userInfo);

    }
})

$(

    function() {
        //退出功能
        $("#loginout").on("tap", function() {
            $.ajax({
                url: "/user/logout",
                type: "get",
                success: function(res) {
                    if (res.success) {
                        mui.toast("退出登录成功");
                        setTimeout(() => {
                            location.href = "login.html"
                        }, 2200)
                    }
                }
            })
        });
        let html = template("userTpl", userInfo);
        $("#userInfor").html(html);

    }
)